home *** CD-ROM | disk | FTP | other *** search
/ X User Tools / X User Tools (O'Reilly and Associates)(1994).ISO / sun4c / archive / tcltk.z / tcltk / man / catn / if.n < prev    next >
Text File  |  1994-09-20  |  2KB  |  67 lines

  1.  
  2.  
  3.  
  4. if(n)                 Tcl Built-In Commands
  5.  
  6.  
  7.  
  8. _________________________________________________________________
  9.  
  10. NAME
  11.      if - Execute scripts conditionally
  12.  
  13. SYNOPSIS
  14.      if _e_x_p_r_1 ?then? _b_o_d_y_1 elseif _e_x_p_r_2 ?then? _b_o_d_y_2  elseif  ...
  15.      ?else? ?_b_o_d_y_N?
  16. _________________________________________________________________
  17.  
  18.  
  19. DESCRIPTION
  20.      The _i_f command evaluates _e_x_p_r_1 as an expression (in the same
  21.      way  that  expr  evaluates  its argument).  The value of the
  22.      expression must be a boolean (a numeric value,  where  0  is  |
  23.      false  and  anything is true, or a string value such as true  |
  24.      or yes for true and false or no for false); if  it  is  true
  25.      then _b_o_d_y_1 is executed by passing it to the Tcl interpreter.
  26.      Otherwise _e_x_p_r_2 is evaluated as an expression and if  it  is
  27.      true  then  body2  is  executed,  and so on.  If none of the
  28.      expressions evaluates to true then _b_o_d_y_N is  executed.   The
  29.      then and else arguments are optional ``noise words'' to make
  30.      the command easier to read.  There  may  be  any  number  of
  31.      elseif  clauses,  including zero.  _B_o_d_y_N may also be omitted
  32.      as long as else is omitted too.  The return value  from  the
  33.      command  is the result of the body script that was executed,
  34.      or an empty string if none of the expressions  was  non-zero
  35.      and there was no _b_o_d_y_N.
  36.  
  37.  
  38. KEYWORDS
  39.      boolean, conditional, else, false, if, true
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63. Tcl                                                             1
  64.  
  65.  
  66.  
  67.